
from django.core.mail import send_mail
from mall import settings
from celery_tasks.main import app
# 发送邮件
@app.task(name='send_email')
# @app.task
def send_email(to_email,verify_url):
    # (subject, message, from_email, recipient_list,
    # 邮件主题  邮件内容  来自谁   收件人列表
    subject='美多商城邮箱验证'

    html_message ='<p>尊敬的用户您好！</p>' \
           '<p>感谢您使用美多商城。</p>' \
           '<p>您的邮箱为：%s 。请点击此链接激活您的邮箱：</p>' \
           '<p><a href="%s">%s<a></p>' % (to_email, verify_url, verify_url)
    from_email= settings.EMAIL_FROM
    # to_email=
    # recipient_list=['2992850128@qq.com','18502726168@163.com']
    recipient_list=[to_email]
    send_mail(subject,'',from_email,recipient_list,html_message=html_message)

# send_email(['2992850128@qq.com','18502726168@163.com'],'ppppppp')